package com.ruoyi.system.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.vo.SelectVo;
import com.ruoyi.system.service.IWmsProductBrandsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsProductBrands;
import com.ruoyi.common.core.page.TableDataInfo;

import java.util.List;

/**
 * 商品品牌Controller
 *
 * @author ruoyi
 * @date 2025-06-11
 */
@RestController
@RequestMapping("/system/wmsProductBrands")
public class WmsProductBrandsController extends BaseController
{
    @Autowired
    private IWmsProductBrandsService wmsProductBrandsService;

    /**
     * 查询商品品牌列表
     */
    @SaCheckPermission("system:wmsProductBrands:list")
    @GetMapping("/list")
    public TableDataInfo<WmsProductBrands> list(WmsProductBrands wmsProductBrands, PageQuery pageQuery)
    {
        return wmsProductBrandsService.selectWmsProductBrandsList(wmsProductBrands,pageQuery);
    }

    /**
     * 导出商品品牌列表
     */
    /*@SaCheckPermission("system:wmsProductBrands:export")
    @Log(title = "商品品牌", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsProductBrands wmsProductBrands)
    {
        List<WmsProductBrands> list = wmsProductBrandsService.selectWmsProductBrandsList(wmsProductBrands);
        ExcelUtil<WmsProductBrands> util = new ExcelUtil<WmsProductBrands>(WmsProductBrands.class);
        util.exportExcel(response, list, "商品品牌数据");
    }*/

    /**
     * 获取商品品牌详细信息
     */
    @SaCheckPermission("system:wmsProductBrands:query")
    @GetMapping(value = "/{id}")
    public R<WmsProductBrands> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(wmsProductBrandsService.selectWmsProductBrandsById(id));
    }

    /**
     * 新增商品品牌
     */
    @SaCheckPermission("system:wmsProductBrands:add")
    @Log(title = "商品品牌", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Void> add(@RequestBody WmsProductBrands wmsProductBrands)
    {
        return toAjax(wmsProductBrandsService.insertWmsProductBrands(wmsProductBrands));
    }

    /**
     * 修改商品品牌
     */
    @SaCheckPermission("system:wmsProductBrands:edit")
    @Log(title = "商品品牌", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Void> edit(@RequestBody WmsProductBrands wmsProductBrands)
    {
        return toAjax(wmsProductBrandsService.updateWmsProductBrands(wmsProductBrands));
    }

    /**
     * 删除商品品牌
     */
    @SaCheckPermission("system:wmsProductBrands:remove")
    @Log(title = "商品品牌", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsProductBrandsService.deleteWmsProductBrandsByIds(ids));
    }

    /**
     * 查询商品品牌列表
     */
    @SaCheckPermission("system:wmsProductBrands:list")
    @GetMapping("/getBrandsSelect")
    public R<List<SelectVo>> getBrandsSelect(){
        return R.ok(wmsProductBrandsService.getBrandsSelect());
    }
}
